import { createApp } from "vue";

import App from "./App.vue";
// 引入element 图标
import { setupElIcons, setupPermission } from "@/plugins";
// 本地SVG图标
import "virtual:svg-icons-register";

import router from "@/router";

import { setupStore } from "@/store";
import "./style.css";
import "@/styles/index.scss";
// 引入封装的directive

import chartResizeDirective from "./utils/directive";

import { fitChartSize } from "@/utils/dataUtil";

const app = createApp(App);
// 注册element 图标
app.use(setupElIcons);

// 注册路由
app.use(router);
// 注册动态路由
setupPermission();

// 全局注册 状态管理(store)
setupStore(app);
// 注册全局自定义指令
app.directive("chart-resize", chartResizeDirective);

// 注册全局方法
app.config.globalProperties.$fitChartSize = fitChartSize;

app.mount("#app");

export default app;
